package cn.jiyun.mapper;

import cn.jiyun.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {


    @Insert("insert into users values(null,#{name},#{sex},#{pwd},#{birth})")
    void inserUser(User user);

    @Select("select * from users")
    List<User> select();

    @Select("select * from users where id=#{id}")
    User selectbyid(Integer id);

    @Update("update users set name=#{name},sex=#{sex},pwd=#{pwd},birth=#{birth} where id=#{id}")
    void update(User user);

    @Delete("delete from users where id=#{id}")
    void delete(Integer id);

    @Select("select * from users where name=#{name} and pwd=#{pwd}")
    User login(User user);
}
